import request from './request';


export async function openGetWindow(documentType, params) {
  request(`/app/api/enumeration-center/documentconfig/getdocumentdetailurl?documenttype=${documentType}`, {
    method: 'post'
  }).then((result) => {
    let url = result;
    const env = url.match(/\{[a-zA-Z0-9]+\}/g);
    for (const p in env) {
      const m = env[p];
      const str = m.substring(1, m.length - 1);
      if (params[str]) {
        url = url.replace(m, params[str]);
      }
    }
    window.open(url);
  });
}

export async function openPostWindow(documentType, params) {
  // 有需要再加上
  console.log('有需要再加上');
}
